package com.biyu.monitormanage.common.utils;

import com.biyu.monitormanage.entity.MachineEntity;
import com.biyu.monitormanage.enums.PositionEnums;

import java.util.Objects;

/**
 * @author 15491
 */
public class MachineUtils {

    public static String getMachineName(MachineEntity machineEntity) {
        StringBuilder machineMonitorName = new StringBuilder();
        // 部门
        machineMonitorName.append(machineEntity.getDepartment());
        // 位置
        String position = PositionEnums.getPosDes(machineEntity.getMachinePosition());
        if (Objects.nonNull(position)) {
            machineMonitorName.append(position);
            machineMonitorName.append("#");
        }
        // 机器名
        return machineMonitorName.append(machineEntity.getMachineName()).append(" ").toString();
    }
}
